<?php
namespace Plu\Library\Models\Platform\Live;

use Phalcon\Mvc\Model,
    Phalcon\Db\Column,
    Phalcon\Mvc\Model\Resultset\Simple as Resultset;

class LiveSource extends Model {

    public $Id;

    public $RoomId;

    public $WSUpRTMPKey;

    public $Status;

    public $CreateTime;

    public $IsTimeMove;

    public $IsTransfer;

    public $WSUpRTMPPath;

    public $UserId;

    public function initialize() {
        $this->setConnectionService('db.platform.slave');
    }

    public function getSource() {
        return 'LiveSource';
    }

    public function getRoomIdByWSUpRTMPKey($WSUpRTMPKey){
        $item = self::findFirst(array(
            "WSUpRTMPKey = :WSUpRTMPKey:",
            "bind" => array(
                'WSUpRTMPKey'=> $WSUpRTMPKey,
            ),
            'bindTypes' => array(
                'uid'		=> Column::BIND_PARAM_INT,
            ),
            'order'	=> "Id DESC"
        ));
        return $item;
    }
}

?>
